package com.zte.claa.inficombo.csa.app.model.redis;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Map;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zte.claa.inficombo.csa.app.util.JsonUtils;

@SuppressWarnings("serial")
public class DevMeteData implements Serializable {
	private static final String DTFormat = "yyyy-MM-dd HH:mm:ss";
	private static final String TIME_ZONE = "GMT+8";
	
	private String deveui;
	private String devname;
	private String devtype;
	private String projectid;
	private String appeui;
	// Lorawan协议约定的由终端自定义的那个port
	private String port;
	
	@JsonFormat(pattern=DTFormat, timezone = TIME_ZONE)
	private Timestamp rpttime;
	// 业务模型测量数据
	private Map<String, Object> mdata;
	
	public DevMeteData(){
		this.rpttime = new Timestamp(System.currentTimeMillis()+(long)(Math.random()*500));
	}

	public String getDeveui() {
		return deveui;
	}

	public void setDeveui(String deveui) {
		this.deveui = deveui;
	}

	public String getDevname() {
		return devname;
	}

	public void setDevname(String devname) {
		this.devname = devname;
	}

	public String getDevtype() {
		return devtype;
	}

	public void setDevtype(String devtype) {
		this.devtype = devtype;
	}

	public String getProjectid() {
		return projectid;
	}

	public void setProjectid(String projectid) {
		this.projectid = projectid;
	}

	public String getAppeui() {
		return appeui;
	}

	public void setAppeui(String appeui) {
		this.appeui = appeui;
	}

	public String getPort() {
		return port;
	}

	public void setPort(String port) {
		this.port = port;
	}

	public Map<String, Object> getMdata() {
		return mdata;
	}

	public void setMdata(Map<String, Object> mdata) {
		this.mdata = mdata;
	}

	public Timestamp getRpttime() {
		return rpttime;
	}

	public void setRpttime(Timestamp rpttime) {
		this.rpttime = rpttime;
	}

	@Override
	public String toString() {
		return "DevMeteData [deveui=" + deveui + ", devname=" + devname + ", devtype=" + devtype + ", projectid="
				+ projectid + ", appeui=" + appeui + ", port=" + port + ", rpttime=" + rpttime + ", mdata=" + mdata
				+ "]";
	}
	
	public String mdata2JsonStr(){
		return JsonUtils.mapToJsonStr(this.mdata);
	}
}
